<%@ page language="java"
	import="com.skyline.jfs.base.model.Administrator,java.util.List"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cluster Administrators</title>
<%
	List<Administrator> administrators = (List<Administrator>) request
			.getAttribute("administrators");
%>
<script type="text/javascript">
	function modifyAdmin() {
		//alert("modifyAdmin");
		var idRadio = document.all.Id;//.getElementById("jobNum");
		//alert(idRadio.length);
		for ( var i = 0; i < idRadio.length; i++) {
			if (idRadio[i].checked == true) {
				location.href = "modifyAdmin/" + idRadio[i].value + ".html";//alert(jobNumRadio[i].value);
				break;
			}
			//alert(jobNumRadio[i].value);
			if (i == idRadio.length - 1) {
				alert("Please choose the Administrator which you want to modify!");
			}
		}
	}
	
	function deleteAdmin() {
		//alert("modifyAdmin");
		var idRadio = document.all.Id;//.getElementById("jobNum");
		for ( var i = 0; i < idRadio.length; i++) {
			if (idRadio[i].checked == true) {
				location.href = "deleteAdmin/" + idRadio[i].value + ".html";//alert(jobNumRadio[i].value);
				break;
			}
			//alert(jobNumRadio[i].value);
			if (i == idRadio.length - 1) {
				alert("Please choose the Administrator which you want to delete!");
			}
		}
	}
</script>
</head>
<body>
<table>
	<tr>
		<td width="240" valign="top"><%@ include file="../adminNavi.jsp"%>
		</td>
		<td valign="top">
		<table>
			<tr bgcolor='#a1a1a1'>
				<td><input type='radio' id='Id' name='Id' value='0' style="display:none"/></td>
				<td>JobNum</td>
				<td>FirstName</td>
				<td>LastName</td>
				<td>Department</td>
				<td>E-mail</td>
				<td>Phone</td>
			</tr>
			<%
				if (administrators != null) {
					int count = administrators.size();
					for (int i = 0; i < count; i++) {
						Administrator a = administrators.get(i);
						if (i % 2 == 1)
							out.println("<tr bgcolor='#f1f1f1'>");
						else
							out.println("<tr>");
						out.println("<td><input type='radio' id='Id' name='Id' value='"
								+ a.getId() + "'/></td>");
						out.println("<td>" + a.getJobNum() + "</td>");
						out.println("<td>" + a.getFirstName() + "</td>");
						out.println("<td>" + a.getLastName() + "</td>");
						out.println("<td>" + a.getDepartment() + "</td>");
						out.println("<td>" + a.getEmail() + "</td>");
						out.println("<td>" + a.getPhone() + "</td>");
						out.println("</tr>");
					}
				}
			%>
			<tr>
				<td colspan='7' align="right"><input type="button" name="add"
					onclick="location.href='addAdmin.html'" value="add"> <input
					type="button" name="modify" onclick="modifyAdmin()" value="modify">
				<input type="button" name="delete" onclick="deleteAdmin()" value="delete"></td>
			</tr>
		</table>

		</td>
	</tr>
</table>
</body>
</html>